<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="google.maps" tagdir="/WEB-INF/tags/googlemaps"%>

<div>
	<div class="map-form">
		<s:form action="saveInstitution">
			<s:fielderror />
			<table>
				<tr>
					<td colspan="2"></td>
				</tr>
				<tr>
					<td><label>Nombre</label></td>
					<td><s:hidden name="id" value="%{institution.id}" /> <s:textfield
							name="name" label="Nombre" value="%{institution.name}" />
					</td>
				</tr>
				<tr>
					<td><label>Mail</label></td>
					<td><s:textfield name="email" label="Mail"
							value="%{institution.email}" /></td>
				</tr>
				<tr>
					<td><label>Telefonos</label></td>
					<td><s:textfield name="phoneNumbers" label="Telefonos"
							value="%{institution.phoneNumbers}" /></td>
				</tr>
				<tr>
					<td><label>Detalle</label></td>
					<td><s:textfield name="detail" label="Detalle"
							value="%{institution.detail}" /></td>
				</tr>
				<tr>
					<td><label>Provincia</label></td>
					<td><s:textfield name="location.province"
							value="%{institution.location.province}" label="Provincia" /></td>
				</tr>
				<tr>
					<td><label>Partido</label></td>
					<td><s:textfield name="location.district"
							value="%{institution.location.district}" label="Partido" /></td>
				</tr>
				<tr>
					<td><label>Ciudad</label></td>
					<td><s:textfield name="location.city"
							value="%{institution.location.city}" label="Ciudad" /></td>
				</tr>
				<tr>
					<td><label>Calle</label></td>
					<td><s:textfield name="location.street"
							value="%{institution.location.street}" label="calle" /></td>
				</tr>
				<tr>
					<td><label>Número</label></td>
					<td><s:textfield name="location.number"
							value="%{institution.location.number}" label="Número" /></td>
				</tr>
				<tr>
					<td><label>Latitud</label></td>
					<td><s:textfield id="latitude" name="location.latitude"
							value="%{institution.location.latitude}" label="Latitud" /></td>
				</tr>
				<tr>
					<td><label>Longitud</label></td>
					<td><s:textfield id="longitude" name="location.longitude"
							value="%{institution.location.longitude}" label="Longitud" />
					</td>
				</tr>
				<tr>
					<td><label>Responsable</label></td>

					<td><s:select value="institution.responsible.id"
							name="responsible.id" list="%{institutionResponsibles}"
							listKey="id" /></td>
				</tr>
				<tr>
					<td><label>Tipo</label></td>

					<td><s:select value="institution.type.id" name="type.id"
							list="%{institutionTypes}" listKey="id" /></td>
				</tr>
			</table>
			<s:submit value="guardar" />
		</s:form>
	</div>
	<div id="map" class="map"></div>
</div>
<div style="clear: both"></div>

<google.maps:Script />
<s:set var="institution" value="institution" scope="request" />
<google.maps:Map container_id="map"
	latitude="${empty institution.location.latitude ? -34.9212936704915 : institution.location.latitude}"
	longitude="${(empty institution.location.longitude) ? -57.9546511173248 : institution.location.longitude}"
	zoom="13">
	<google.maps:LatLngInputField latitude_id="latitude"
		longitude_id="longitude" />
</google.maps:Map>